package model;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;

public class Goods {
    private Long          g_id;          //auto increment
    private String        g_name;        //not null
    private Long          st_id;         //not null
    private BigDecimal    g_price;       //not null
    private BigDecimal    g_vip_price;
    private String        g_descript;
    private String        g_pic_address;
    private String        g_barcode;     //not null
    private Long          g_count;
    private LocalDateTime g_slife;
    private Integer       g_score;
    private String        g_status;      //not null

    public Goods() {
    }

    public Goods(long g_id, String g_name, Long st_id, BigDecimal g_price, BigDecimal g_vip_price, String g_descript, String g_pic_address, String g_barcode, long g_count, LocalDateTime g_slife, int g_score, String g_status) {
        this.g_id = g_id;
        this.g_name = g_name;
        this.st_id = st_id;
        this.g_price = g_price;
        this.g_vip_price = g_vip_price;
        this.g_descript = g_descript;
        this.g_pic_address = g_pic_address;
        this.g_barcode = g_barcode;
        this.g_count = g_count;
        this.g_slife = g_slife;
        this.g_score = g_score;
        this.g_status = g_status;
    }

    public Goods(Object[] rowRecord) {
        this.g_id = (Long) rowRecord[0];
        this.g_name = (String) rowRecord[1];
        this.st_id = (Long) rowRecord[2];
        this.g_price = (BigDecimal) rowRecord[3];
        this.g_vip_price = (BigDecimal) rowRecord[4];
        this.g_descript = (String) rowRecord[5];
        this.g_pic_address = (String) rowRecord[6];
        this.g_barcode = (String) rowRecord[7];
        this.g_count = (Long) rowRecord[8];
        this.g_slife = (LocalDateTime) rowRecord[9];
        this.g_score = (Integer) rowRecord[10];
        this.g_status = (String) rowRecord[11];
    }

    @Override
    public String toString() {
        return "Goods{" +
                "g_id=" + g_id +
                ", g_name='" + g_name + '\'' +
                ", st_id=" + st_id +
                ", g_price=" + g_price +
                ", g_vip_price=" + g_vip_price +
                ", g_descript='" + g_descript + '\'' +
                ", g_pic_address='" + g_pic_address + '\'' +
                ", g_barcode='" + g_barcode + '\'' +
                ", g_count=" + g_count +
                ", g_slife=" + g_slife +
                ", g_score=" + g_score +
                ", g_status='" + g_status + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Goods goods = (Goods) o;
        return g_id.equals(goods.g_id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(g_id);
    }

    public Long getSt_id() {
        return st_id;
    }

    public void setSt_id(Long st_id) {
        this.st_id = st_id;
    }

    public Long getG_id() {
        return g_id;
    }

    public void setG_id(long g_id) {
        this.g_id = g_id;
    }

    public String getG_name() {
        return g_name;
    }

    public void setG_name(String g_name) {
        this.g_name = g_name;
    }

    public BigDecimal getG_price() {
        return g_price;
    }

    public void setG_price(BigDecimal g_price) {
        this.g_price = g_price;
    }

    public BigDecimal getG_vip_price() {
        return g_vip_price;
    }

    public void setG_vip_price(BigDecimal g_vip_price) {
        this.g_vip_price = g_vip_price;
    }

    public String getG_descript() {
        return g_descript;
    }

    public void setG_descript(String g_descript) {
        this.g_descript = g_descript;
    }

    public String getG_pic_address() {
        return g_pic_address;
    }

    public void setG_pic_address(String g_pic_address) {
        this.g_pic_address = g_pic_address;
    }

    public String getG_barcode() {
        return g_barcode;
    }

    public void setG_barcode(String g_barcode) {
        this.g_barcode = g_barcode;
    }

    public Long getG_count() {
        return g_count;
    }

    public void setG_count(long g_count) {
        this.g_count = g_count;
    }

    public LocalDateTime getG_slife() {
        return g_slife;
    }

    public void setG_slife(LocalDateTime g_slife) {
        this.g_slife = g_slife;
    }

    public Integer getG_score() {
        return g_score;
    }

    public void setG_score(int g_score) {
        this.g_score = g_score;
    }

    public String getG_status() {
        return g_status;
    }

    public void setG_status(String g_status) {
        this.g_status = g_status;
    }

}
